import dungeon from './template/dungeon'
import monster from './template/monster'
import player from './template/player'
import map from './template/map'
import resource from './template/resource'
import npc from './template/npc'
import task from './template/task'
import mapList from './template/mapList'

let item = {}
import item_200000 from './template/item/item_200000'
import item_210000 from './template/item/item_210000'
import item_220000 from './template/item/item_220000'
Object.assign(item, item_200000, item_210000, item_220000);

let lattice = {}
import lattice_270000 from './template/lattice/lattice_270000'
Object.assign(lattice, lattice_270000);



let totalConfig = {} //所有模板信息
let propName = {} // id => name
let itemConfig = {}

function setTemplateInfo(templateInfo) {
    let temp = {}
    for (let i in templateInfo) {
        temp[i] = templateInfo[i]
        temp[i]['templateId'] = i
        temp[i]['type'] = Math.floor(i / 10000)
        if (templateInfo[i].name) {
            propName[i] = templateInfo[i].name
        }
        itemConfig[i] = templateInfo[i]
    }
    return temp
}

totalConfig['dungeon'] = setTemplateInfo(dungeon)
totalConfig['monster'] = setTemplateInfo(monster)
totalConfig['player'] = setTemplateInfo(player)
totalConfig['map'] = setTemplateInfo(map)
totalConfig['resource'] = setTemplateInfo(resource)
totalConfig['npc'] = setTemplateInfo(npc)
totalConfig['task'] = setTemplateInfo(task)
totalConfig['mapList'] = setTemplateInfo(mapList)
totalConfig['lattice'] = setTemplateInfo(lattice)
totalConfig['item'] = setTemplateInfo(item)

exports.totalConfig = totalConfig
exports.propName = propName
exports.itemConfig = itemConfig
